#ifndef myrpccontroller_h__
#define myrpccontroller_h__

#include <string>
#include "../google/protobuf/service.h"

namespace myrpc
{
	class MyRpcController : public google::protobuf::RpcController {
	public:
		MyRpcController() { Reset(); }
		
		void Reset()
		{
			_error_str = "";
			_is_failed = false;
		}

		bool Failed() const
		{
			return _is_failed;
		}
		
		std::string ErrorText() const
		{
			return _error_str;
		}

		void StartCancel()
		{ 
			return;
		}
	
		void SetFailed(const std::string &reason)
		{
			_is_failed = true;
			_error_str = reason;
		}
		
		bool IsCanceled() const
		{ 
			return false;
		}
	
		void NotifyOnCancel(google::protobuf::Closure* callback)
		{ 
			return;
		}

	private:
		std::string _error_str;
		bool _is_failed;
	};	
}

#endif // myrpccontroller_h__
